﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Threading;
using System.IO;
using System.Xml;
using System.Web;
using System.Runtime.InteropServices;
using System.IO.Ports;
using weiqijiance;
using ZedGraph;
using CCWin;
namespace weiqijiance
{
    public partial class JDBianJiaZai : CCSkinMain
    {
        public mainform m_mainform;

        public Thread t1;
        public Thread t2;

        public float fgonglv;
        public float fspeed;
        public bool btingzhi;

        public float kbjz;
        public float fSpeedStrat;
        public float fSpeedEnd;
        public float DIW;
        public float flilingwei;

        public double dli;
        public double dtime;
        public double dwc;

        double[] dtimex = new double[10000];
        double[] dSP = new double[10000];
        double[] dPW = new double[10000];

        DateTime dstartgcsj;
        public int igcsj;
        public double dymax;
        DateTime dpinlv;

        public float m_fspeed;
        public float fForce;

        public string sASMJGXZ;//是否进行结果修正
        public int iASMtdz;//ASM信号左通道
        public int iASMtdy;//ASM信号右通道
        public int iASMtdh;//ASM信号右通道
        public int iASMHWQ;//ASM到位红外

        public int iASMKZJSS;//ASM举升升
        public int iASMKZJSJ;//ASM举升降
        public int iASMSDtd;//车速信号接在那个通道
        //红外取反
        public bool[] bhongwaiqf = new bool[16] { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };//红外是否取反
        //红外定位时间
        public int[] ihongwaidwsj = new int[16] { 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000 };//红外定位时间单位毫秒


        public JDBianJiaZai()
        {
            InitializeComponent();
        }
        #region 控件大小随窗体大小等比例缩放
        private float x;//定义当前窗体的宽度
        private float y;//定义当前窗体的高度
        private void setTag(Control cons)
        {
            foreach (Control con in cons.Controls)
            {
                con.Tag = con.Width + ";" + con.Height + ";" + con.Left + ";" + con.Top + ";" + con.Font.Size;
                if (con.Controls.Count > 0)
                {
                    setTag(con);
                }
            }
        }
        private void setControls(float newx, float newy, Control cons)
        {
            //遍历窗体中的控件，重新设置控件的值
            foreach (Control con in cons.Controls)
            {
                //获取控件的Tag属性值，并分割后存储字符串数组
                if (con.Tag != null)
                {
                    string[] mytag = con.Tag.ToString().Split(new char[] { ';' });
                    //根据窗体缩放的比例确定控件的值
                    con.Width = Convert.ToInt32(System.Convert.ToSingle(mytag[0]) * newx);//宽度
                    con.Height = Convert.ToInt32(System.Convert.ToSingle(mytag[1]) * newy);//高度
                    con.Left = Convert.ToInt32(System.Convert.ToSingle(mytag[2]) * newx);//左边距
                    con.Top = Convert.ToInt32(System.Convert.ToSingle(mytag[3]) * newy);//顶边距
                    Single currentSize = System.Convert.ToSingle(mytag[4]) * newy;//字体大小
                    con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
                    if (con.Controls.Count > 0)
                    {
                        setControls(newx, newy, con);
                    }
                }
            }
        }
        #endregion

        private delegate void FlushClient();//代理
        private void xianshiGL()
        {
            if (this.text_gonglv.InvokeRequired)//等待异步
            {
                FlushClient fc = new FlushClient(xianshiGL);
                this.Invoke(fc);//通过代理调用刷新方法
            }
            else
            {
                this.text_gonglv.Text = string.Format(@"{0}", fgonglv);
            }
        }

        private void xianshiSpeed()
        {
            if (this.text_sudu.InvokeRequired)//等待异步
            {
                FlushClient fc = new FlushClient(xianshiSpeed);
                this.Invoke(fc);//通过代理调用刷新方法
            }
            else
            {
                this.text_sudu.Text = string.Format(@"{0}", fspeed.ToString("0.00"));
            }
        }

        private void xianshitimeli()
        {
            if (this.text_sudu.InvokeRequired)//等待异步
            {
                FlushClient fc = new FlushClient(xianshitimeli);
                this.Invoke(fc);//通过代理调用刷新方法
            }
            else
            {
                this.text_timell.Text = string.Format(@"{0:N2}", dli);
            }
        }



        private void xianshitimesj()
        {
            if (this.text_sudu.InvokeRequired)//等待异步
            {
                FlushClient fc = new FlushClient(xianshitimesj);
                this.Invoke(fc);//通过代理调用刷新方法
            }
            else
            {
                this.text_timesj.Text = string.Format(@"{0}", dtime);
            }
        }
        //
        private void xianshitimewc()
        {
            if (this.text_sudu.InvokeRequired)//等待异步
            {
                FlushClient fc = new FlushClient(xianshitimewc);
                this.Invoke(fc);//通过代理调用刷新方法
            }
            else
            {
                this.text_wucha.Text = string.Format(@"{0:N3}", dwc);
            }
        }
        public void gettongdao()
        {

            string path = "";
            path = System.Windows.Forms.Application.StartupPath + path + "\\串口及通道设置.ini";
            string path1 = string.Format(@"{0}", path);
            m_mainform.Ini(path1);

            ///读取检定数据

            for (int i = 0; i < 10; i++)
            {
                string sgetname = m_mainform.ReadValue("通道设置", string.Format(@"模拟信号{0}", i + 1));
                if (sgetname.Contains("测功力左"))
                {
                    iASMtdz = i;
                }

                if (sgetname.Contains("测功力右"))
                {
                    iASMtdy = i;
                }

                if (sgetname.Contains("测功力后"))
                {
                    iASMtdh = i;
                }
            }

            for (int i = 0; i < 8; i++)
            {
                string smaichong = m_mainform.ReadValue("通道设置", string.Format(@"速度{0}", i + 1));
                if (smaichong.Contains("速度"))
                {
                    iASMSDtd = i;
                }

            }

            for (int i = 0; i < 16; i++)
            {
                string shongwai = m_mainform.ReadValue("通道设置", string.Format(@"红外{0}", i + 1));
                if (shongwai.Contains("测功机到位"))
                {
                    iASMHWQ = i;
                }


                shongwai = m_mainform.ReadValue("通道设置", string.Format(@"红外定位时间{0}", i + 1));
                int.TryParse(shongwai, out ihongwaidwsj[i]);


                shongwai = m_mainform.ReadValue("通道设置", string.Format(@"红外是否取反{0}", i + 1));
                if (shongwai.Contains("是"))
                {
                    bhongwaiqf[i] = true;
                }
                else
                {
                    bhongwaiqf[i] = false;
                }
            }
            ///控制
            for (int i = 0; i < 8; i++)
            {

                string shongwai = m_mainform.ReadValue("通道设置", string.Format(@"控制{0}", i + 1));
                if (shongwai.Contains("测功举升升"))
                {
                    iASMKZJSS = i;
                }
                if (shongwai.Contains("测功举升降"))
                {
                    iASMKZJSJ = i;
                }
            }
        }
        public void Thread1()
        {
            try
            {
                if (kaishispeed.Text.Contains("48.3"))
                {
                    testjiazaiDRS();
                }
                else
                {
                    testjiazaiYRS();
                }
            }
            catch
            {
 
            }
        }
        public void Thread2()
        {
           

        }
        public void WriteGraph(ZedGraphControl zgc)
        {
            GraphPane myPane = zgc.GraphPane;
             myPane.Fill = new Fill(Color.White, Color.Aqua, 45.0f);
           // myPane.Fill = new Fill(Color.White, Color.Red, 45.0f);
            myPane.Legend.Fill = new Fill(Color.Gainsboro);
            myPane.Chart.Fill = new Fill(Color.Gainsboro);

            myPane.CurveList.Clear();

            // Set the titles and axis labels 设置标题、坐标轴标签
            myPane.Title.Text = string.Format("变加载检定过程曲线");

            myPane.XAxis.Title.Text = "时间(s)";
            myPane.YAxis.Title.Text = "过程数据";

            myPane.YAxis.MajorGrid.IsVisible = true;//网格
            myPane.YAxis.MinorTic.Size = 0f;

            // myPane.XAxis.MajorGrid.IsVisible = true;//网格
            myPane.XAxis.MinorTic.Size = 0f;

            myPane.XAxis.MajorGrid.DashOff = 0;
            myPane.YAxis.MinorGrid.DashOff = 0;


            //Y轴坐标刻度
            myPane.YAxis.Scale.Min = 0;
            myPane.YAxis.Scale.Max = 10;
            myPane.YAxis.Scale.MinorStep = 1;//轴小步长1,也就是小间隔
            myPane.YAxis.Scale.MajorStep = 1;//轴大步长为5，也就是显示文字的大间隔


            //Y轴坐标刻度
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 10;
            myPane.XAxis.Scale.MinorStep = 1;//轴小步长1,也就是小间隔
            myPane.XAxis.Scale.MajorStep = 1;//轴大步长为5，也就是显示文字的大间隔


            zgc.IsShowPointValues = true;//数据节点




            string ss0 = string.Format("{0}", "Speed");
            string ss1 = string.Format("{0}", "Power");


            // Make up some data points from the Sine function 弥补一些数据点的正弦函数
            PointPairList list0 = new PointPairList();
            PointPairList list1 = new PointPairList();

            // Generate a blue curve with circle symbols, and "My Curve 2" in the legend 生成一个与圆符号蓝色曲线，和“我的曲线2”的传说
            LineItem myCurve0 = myPane.AddCurve(ss0, list0, Color.Blue,
                                    SymbolType.None);
            LineItem myCurve1 = myPane.AddCurve(ss1, list1, Color.Red,
                                    SymbolType.None);


            myCurve0.Line.Width = 1.7F;
            myCurve1.Line.Width = 1.7F;


            zgc.AxisChange();
            zgc.Invalidate();
        }

        public void WriteGraphEX(ZedGraphControl zgc, double[] time, double[] d1, double[] d2, double ymax, double xmax, int icount)
        {
            GraphPane myPane = zgc.GraphPane;
            myPane.Fill = new Fill(Color.White, Color.Aqua, 45.0f);
           // myPane.Fill = new Fill(Color.White, Color.Red, 45.0f);
            myPane.Legend.Fill = new Fill(Color.Gainsboro);
            myPane.Chart.Fill = new Fill(Color.Gainsboro);

            myPane.CurveList.Clear();

            // Set the titles and axis labels 设置标题、坐标轴标签
            myPane.Title.Text = string.Format("变加载检定过程曲线");

            myPane.XAxis.Title.Text = "时间(s)";
            myPane.YAxis.Title.Text = "过程数据";

            myPane.YAxis.MajorGrid.IsVisible = true;//网格
            myPane.YAxis.MinorTic.Size = 0f;

            // myPane.XAxis.MajorGrid.IsVisible = true;//网格
            myPane.XAxis.MinorTic.Size = 0f;

            myPane.XAxis.MajorGrid.DashOff = 0;
            myPane.YAxis.MinorGrid.DashOff = 0;


            //Y轴坐标刻度
            myPane.YAxis.Scale.Min = 0;
            myPane.YAxis.Scale.Max = (double)((int)(ymax * 0.1) + 3) * 10;
            myPane.YAxis.Scale.MinorStep = 1;//轴小步长1,也就是小间隔
            myPane.YAxis.Scale.MajorStep = (double)((int)(ymax * 0.1) + 1);//轴大步长为5，也就是显示文字的大间隔


            //Y轴坐标刻度
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = xmax;
            myPane.XAxis.Scale.MinorStep = 1;//轴小步长1,也就是小间隔
            myPane.XAxis.Scale.MajorStep = (double)((int)(xmax * 0.1) + 1);//轴大步长为5，也就是显示文字的大间隔


            zgc.IsShowPointValues = true;//数据节点



            string ss0 = string.Format("{0}", "Speed");
            string ss1 = string.Format("{0}", "Power");


            // Make up some data points from the Sine function 弥补一些数据点的正弦函数
            PointPairList list0 = new PointPairList();
            PointPairList list1 = new PointPairList();

            // Generate a blue curve with circle symbols, and "My Curve 2" in the legend 生成一个与圆符号蓝色曲线，和“我的曲线2”的传说
            LineItem myCurve0 = myPane.AddCurve(ss0, list0, Color.Blue,
                                    SymbolType.None);
            LineItem myCurve1 = myPane.AddCurve(ss1, list1, Color.Red,
                                    SymbolType.None);


            myCurve0.Line.Width = 1.7F;
            myCurve1.Line.Width = 1.7F;


            if (icount > 0)
            {
                for (int i = 0; i < icount; i++)
                {
                    list0.Add(time[i], d1[i]);
                    list1.Add(time[i], d2[i]);
                }
            }

            zgc.AxisChange();
            zgc.Invalidate();
        }

        public void sendgcqx()
        {
            //过程数据
            if (DateDiff(DateTime.Now, dpinlv) > 500)
            {
                dSP[igcsj] = (double)fspeed;
                dPW[igcsj] = fForce * fspeed / 360;
                dtimex[igcsj] = DateDiff(DateTime.Now, dstartgcsj) / 1000;

                for (int i = 0; i < igcsj; i++)
                {
                    if (dymax < dSP[igcsj])
                    {
                        dymax = dSP[igcsj];
                    }
                    if (dymax < dPW[igcsj])
                    {
                        dymax = dPW[igcsj];
                    }
                }

                WriteGraphEX(zedGraphControl1, dtimex, dSP, dPW, dymax, dtimex[igcsj], igcsj + 1);
                igcsj++;
                dpinlv = DateTime.Now;
            }
        }

        public void testjiazaiDRS()//变加载测试点燃式 48.3~16.1
        {

            m_mainform.DAC.PutVol(0);
            Thread.Sleep(1000);
            m_mainform.BianPinQi(true);
            Thread.Sleep(3000);
            m_mainform.BianPinQiSpeed(256 * 50);//设置频率
            dstartgcsj = DateTime.Now;
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed > fSpeedStrat + 6)
                {
                    m_mainform.BianPinQi(false); ;//关闭电源电源
                    break;
                }
                fgonglv = ((m_mainform.m_fForce  - flilingwei) * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();

                //过程数据
                sendgcqx();


            }
            DateTime dstart;
            DateTime dend;

            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= fSpeedStrat)
                {
                    dstart = DateTime.Now;//记录开始滑行时间
                    m_mainform.DAC.PutVol(200 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();

            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 46.7)
                {
                    m_mainform.DAC.PutVol(200 * kbjz - 1 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 45.1)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 2 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 43.4)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 3 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 41.8)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 4 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 40.2)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 5 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 38.6)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 6 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 37)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 7 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 35.4)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 8 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 33.8)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 9 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 32.2)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz - 10 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 30.6)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 11 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 29)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 12 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 27.4)
                {
                
                    m_mainform.DAC.PutVol(200 * kbjz - 13 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 25.7)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 14 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 24.1)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz - 15 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 22.5)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz - 16 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 20.9)
                {
                 
                    m_mainform.DAC.PutVol(200 * kbjz - 17 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 19.3)
                {
                 
                    m_mainform.DAC.PutVol(200 * kbjz - 18 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 17.7)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz - 19 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();
            }
            

           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= fSpeedEnd)
                {//记录结束滑行时间
                    dend = DateTime.Now;
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
                //过程数据
                sendgcqx();

            }
            m_mainform.DAC.PutVol(0);
            double acdt = 0;
       
            acdt = DateDiff(dend, dstart) * 0.001;
            double dwucha = 0;
            double ccdt = 0;
     
           
            ccdt = 0.00707 * DIW;
            dwucha = 100 * (acdt - ccdt) / ccdt;

            dli = ccdt;
            dtime = acdt;
            dwc = dwucha * m_mainform.m_fhejiazai;

            xianshitimeli();
            xianshitimesj();
            xianshitimewc();




        }

        public void testjiazaiYRS()//变加载测试压燃式 48.3~16.1
        {

            m_mainform.DAC.PutVol(0);
            Thread.Sleep(1000);
            m_mainform.BianPinQi(true);
            Thread.Sleep(3000);
            m_mainform.BianPinQiSpeed(256 * 50);//设置频率
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed > fSpeedStrat + 6)
                {
                    m_mainform.BianPinQi(false); ;//关闭电源电源
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();

            }
            DateTime dstart;
            DateTime dend;

           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= fSpeedStrat)
                {
                    dstart = DateTime.Now;//记录开始滑行时间
                    m_mainform.DAC.PutVol(200 * kbjz - 19 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 70.8)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz - 22 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 69.2)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz - 19* 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 67.6)
                {
                 
                    m_mainform.DAC.PutVol(200 * kbjz - 17 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 66.0)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 14 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 64.4)
                {
                    
                    m_mainform.DAC.PutVol(200 * kbjz - 11 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 62.8)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 9 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 61.1)
                {
                   
                    m_mainform.DAC.PutVol(200 * kbjz - 2 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 59.5)
                {
             
                    m_mainform.DAC.PutVol(200 * kbjz - 1 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 57.9)
                {
                
                    m_mainform.DAC.PutVol(200 * kbjz -1 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }

           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 56.3)
                {
              
                    m_mainform.DAC.PutVol(200 * kbjz + 0 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }

           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 54.7)
                {
                 
                    m_mainform.DAC.PutVol(200 * kbjz + 1 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }

            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 53.1)
                {
                 
                    m_mainform.DAC.PutVol(200 * kbjz + 2 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }


           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 51.5)
                {
                  
                    m_mainform.DAC.PutVol(200 * kbjz + 1 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }

            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 49.9)
                {
                 
                    m_mainform.DAC.PutVol(200 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 46.7)
                {
                    m_mainform.DAC.PutVol(200 * kbjz - 1 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 45.1)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 2 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 43.4)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 3 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 41.8)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 4 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 40.2)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 5 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 38.6)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 6 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 37)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 7 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 35.4)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 8 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 33.8)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 9 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 32.2)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 10 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 30.6)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 11 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 29)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 12 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 27.4)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 13 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 25.7)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 14 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 24.1)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 15 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 22.5)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 16 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 20.9)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 17 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 19.3)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 18 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }
           while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= 17.7)
                {

                    m_mainform.DAC.PutVol(200 * kbjz - 19 * 2 * kbjz);//开始加载  直接输出标定对应的数值 让第一次输出产生的力尽量接近设置的值
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();
            }


            while(true)
            {
                Thread.Sleep(20);
                m_fspeed = m_mainform.DAC.getjsz("测功速度", m_mainform.DAC.fTIData[iASMSDtd]);
                float fzou = m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataSU[iASMtdz]) - m_mainform.DAC.getjsz("测功力左", m_mainform.DAC.fAIDataZero[iASMtdz]);
                float fyou = m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataSU[iASMtdy]) - m_mainform.DAC.getjsz("测功力右", m_mainform.DAC.fAIDataZero[iASMtdy]);
                float fhou = m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataSU[iASMtdh]) - m_mainform.DAC.getjsz("测功力后", m_mainform.DAC.fAIDataZero[iASMtdh]);

                fForce = fzou + fyou + fhou;
                if (fForce < 0)
                {
                    fForce = 0;
                }
                if (m_fspeed <= fSpeedEnd)
                {//记录结束滑行时间
                    dend = DateTime.Now;
                    break;
                }
                fgonglv = (fForce * m_fspeed) / 360;
                fspeed = m_fspeed;
                xianshiGL();
                xianshiSpeed();

            }
            m_mainform.DAC.PutVol(0);
            double acdt = 0;
            acdt = DateDiff(dend,dstart) * 0.001;
            double dwucha = 0;
            double ccdt = 0;


            ccdt = 0.00707 * DIW;
            dwucha = 100 * (acdt - ccdt) / ccdt;

            dli = ccdt;
            dtime = acdt;
            dwc = dwucha * m_mainform.m_fhejiazai;

            xianshitimeli();
            xianshitimesj();
            xianshitimewc();




        }
 

        private void but_kaishi_Click(object sender, EventArgs e)
        {

            kbjz = m_mainform.m_fbianjiazaiSC;
            float.TryParse(kaishispeed.Text,out fSpeedStrat);
            float.TryParse(jieshuspeed.Text, out fSpeedEnd);
            m_mainform.DAC.Lift(false);
            Thread.Sleep(1500);
            ///读取检定数据
            m_mainform.DAC.tiaoling();//调零
            string path = "";
            //path = System.Windows.Forms.Application.StartupPath + path + "\\设备检定结果.ini";
            //string path1 = string.Format(@"{0}", path);
            //m_mainform.Ini(path1);

            //float.TryParse(m_mainform.ReadValue("惯量检定", "惯量"), out DIW);

            path = System.Windows.Forms.Application.StartupPath + path + "\\检测设备信息设置.ini";
            string path1 = string.Format(@"{0}", path);
            m_mainform.Ini(path1);

            float.TryParse(m_mainform.ReadValue("检测设备信息", "台架惯量"), out DIW);
            if (DIW < 1)
            {
                DIW = 910;
            }

            btingzhi = false;
            flilingwei = m_mainform.m_fForce;

            t1 = new Thread(new ThreadStart(Thread1));
            t1.Priority = ThreadPriority.BelowNormal;
            t1.Start();
        }

        private void but_tingzhi_Click(object sender, EventArgs e)
        {
            m_mainform.DAC.PutVol(0);
            Thread.Sleep(1000);
            m_mainform.BianPinQi(false);
            btingzhi = true;
            t1.Abort();
            t1.DisableComObjectEagerCleanup();

            t2.Abort();
            t2.DisableComObjectEagerCleanup();
        }

        private double DateDiff(DateTime DateTime1, DateTime DateTime2)
        {
            double dateDiff = 0;
            TimeSpan ts = DateTime1.Subtract(DateTime2).Duration();
            dateDiff = ts.Days* 60* 60 * 60 * 1000 + ts.Hours * 60 * 60 * 1000 + ts.Minutes * 60 * 1000 + ts.Seconds * 1000 + ts.Milliseconds;
            return dateDiff;
        }

        private void JDBianJiaZai_Resize(object sender, EventArgs e)
        {
            float newx = (this.Width) / x;
            float newy = (this.Height) / y;
            setControls(newx, newy, this);
        }

        private void JDBianJiaZai_Load(object sender, EventArgs e)
        {

            gettongdao();
            WriteGraph(zedGraphControl1);
            DIW = 0;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            x = this.Width;
            y = this.Height;
            setTag(this);
        }

        private void JDBianJiaZai_FormClosing(object sender, FormClosingEventArgs e)
        {

            m_mainform.DAC.PutVol(0);
            Thread.Sleep(1000);
            m_mainform.BianPinQi(false);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            m_mainform.DAC.Lift(true);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            m_mainform.DAC.Lift(false);
        }

        private void text_wucha_Click(object sender, EventArgs e)
        {

        }

        private void text_timesj_Click(object sender, EventArgs e)
        {

        }
    }
}
